#include <OIS.h>
#include "PlayerKeyController.h"
#include "InputManager.h"

void PlayerKeyController::Send( PapaBallMsg msg )
{
	throw std::exception("The method or operation is not implemented.");
}

void PlayerKeyController::AddTime( Ogre::Real deltaTime )
{
	OIS::Keyboard* keyboard= PapaBallInputManager::getSingletonPtr()->GetKeyBoardDevice();
	
	Vector3 dir(0.0);
	if(keyboard->isKeyDown(OIS::KeyCode::KC_J))
		dir.x-=-5;
	if(keyboard->isKeyDown(OIS::KeyCode::KC_L))
		dir.x+=-5;
	if(keyboard->isKeyDown(OIS::KeyCode::KC_I))
		dir.z-=-5;
	if(keyboard->isKeyDown(OIS::KeyCode::KC_K))
		dir.z+=-5;
	m_playerModel->setDirection(dir);

	Ogre::Quaternion quat = Ogre::Vector3::UNIT_Z.getRotationTo(m_playerModel->getDirection());
	m_playerModel->setTargetOrientation(quat,0.1);
	m_playerModel->AddTime(deltaTime);
}

void PlayerKeyController::AddTimeEnded( Ogre::Real deltaTime )
{
	//throw std::exception("The method or operation is not implemented.");
}

